package com.tiger.contact;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import android.app.Activity;
import android.app.AlertDialog;
import android.app.ProgressDialog;
import android.content.ContentValues;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.database.Cursor;
import android.net.Uri;
import android.provider.Contacts;
import android.provider.ContactsContract;
import android.provider.Contacts.People;
import android.util.Log;
import android.widget.CheckBox;

public class CommonUtil {
	private static String idpre = "020509";
	public static void dismissDialog(ProgressDialog pd_downloading){
		if (pd_downloading != null) {
			pd_downloading.dismiss();
			pd_downloading = null;
		}
	}
	public static void alert(Activity act, String msg, String title) {
		AlertDialog.Builder builder = new AlertDialog.Builder(act);
		builder.setMessage(msg);
		if (title != null)
			builder.setTitle(title);
		builder.setPositiveButton("确定", new DialogInterface.OnClickListener() {
			public void onClick(DialogInterface dialog, int id) {

			}
		});
		builder.show();
	}
	
	public static void makePhoneCall(Context context, String phoneNumber) {
		try {
			if (context == null)
				return;
			if (phoneNumber != null && phoneNumber.trim() != "") {
				phoneNumber = "tel:" + phoneNumber;
				Intent intent = new Intent(Intent.ACTION_CALL, Uri
						.parse(phoneNumber));
				context.startActivity(intent);
			} else {
				Intent intent = new Intent(Intent.ACTION_DIAL, null);
				context.startActivity(intent);
			}
		} catch (Exception ex) {
			ex.printStackTrace();
		}
	}
}
